import Mock from 'mockjs';

/* tab组件的数据 */
var tabData=['综合排序','距离最近','销量最高','筛选'];
Mock.mock('/getTab','get',function(){
    return {list:tabData}
})
/* 轮播图组件的数据 */
var bannerData=Mock.mock({
    "list|100":[{
        "id|+1":1,
        "pic":"@image(300x200,@color)",
        "txt":"@ctitle"
    }]
})
Mock.mock('/getbanner','post',function(options){
    var params=JSON.parse(options.body);
    var {count}=params;
    var arr=bannerData.list.slice(0,count);
    return {
        list:arr
    }
})
/* 商店页面的所有数据 */
var allShop=Mock.mock({
    "list|5":[{
        "shop|+1":[{
            "id|+1":1,
            "pic":"@image(100x100,@color)",
            "name":"@ctitle",
            "num|50-1000":1,
            "city|1-5.2":1,
            "content|5":[{
                "title|+1":"@ctitle",
                "content|10":[{
                    "id|+1":1,
                    "pic":"@image(50x50,@color)",
                    "name":"@ctitle",
                    "title|2":"@ctitle",
                    "count":1,
                    "money|20-100":1,
                    "flag":false
                }]
            }]
        }]
    }]
})
Mock.mock('/allshop','get',function(){//只是渲染了所有商店数据
    return allShop;
})